package com.sita.tboard.hitchhike.pick;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.sinaapp.myron.library.SwipeDialog;
import com.sita.bike.R;
import com.sita.tboard.hitchhike.bean.CallcarBean;
import com.sita.tboard.hitchhike.helper.HitchhikeNetworkHelper;
import com.sita.tboard.hitchhike.listeners.OnHitchhikeAcceptTripPlanListener;
import com.sita.tboard.util.TextUtils;

import butterknife.Bind;
import butterknife.ButterKnife;
import cn.trinea.android.common.util.ToastUtils;

/**
 * Created by myron.lg on 2015/8/12.
 */
public class DriverNotificationDialog extends SwipeDialog {
    //    @Bind(R.id.avatar)
//    de.hdodenhof.circleimageview.CircleImageView avatarView;
    @Bind(R.id.nickname)
    TextView nicknameView;
    @Bind(R.id.mobile)
    TextView mobileView;
    @Bind(R.id.from_address)
    TextView fromAddressView;
    @Bind(R.id.to_address)
    TextView toAddressView;
    @Bind(R.id.btn_accept)
    Button acceptBtn;

    private CallcarBean mCallcarBean;

    public DriverNotificationDialog(Context context) {
        super(context);
    }

    public DriverNotificationDialog(Context context, CallcarBean callcarBean) {
        super(context);
        mCallcarBean = callcarBean;
    }

    public DriverNotificationDialog(Context context, int theme) {
        super(context, theme);
    }

    protected DriverNotificationDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_callcar_driver_notification);

        ButterKnife.bind(this);

        nicknameView.setText(mCallcarBean.nickname);
        mobileView.setText(mCallcarBean.mobile);
        fromAddressView.setText(mCallcarBean.fromaddress);
        toAddressView.setText(mCallcarBean.toaddress);

//        acceptBtn.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                HitchhikeNetworkHelper.INSTANCE.passengerPayTrip(mCallcarBean.rentTripId, new OnHitchhikeAcceptTripPlanListener() {
//                    @Override
//                    public void onSuccess() {
//                        dismiss();
//                    }
//
//                    @Override
//                    public void onFailure(Throwable throwable) {
//                        ToastUtils.show(getContext(), TextUtils.getThrowableMessage(throwable));
//                    }
//                });
//            }
//        });
    }
}
